Map Data to Elements

Once you have created a Datasource, you can link the data items in its Dataset(s) to Elements on your form so that Elements can read data from the data items and/or write data to the data items. We call this linking, 'mapping'.

Elements can have 'input' and 'output' mappings. An input mapping allows an Element to take a value from a particular column in a database record (or a column in a table obtained from a Web APIClosed An API is a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other service.) and place it into the Element, usually in order to display that value within the Element. An output mapping allows an Element to take its current value and write it to a particular column in a database record.

 

Form Studio displays the following symbols in the top right-hand corner of an Element in the Form Design workspace to indicate that the Element has a data mapping defined:

Picture showing Input-Mapped button. - indicates that the Element has an input mapping

Picture showing Output-Mapped button. - indicates that the Element has an output mapping

Both symbols will be displayed where the Element has both an input and an output mapping.

The data mappings will also be displayed in the properties for the Element, under the Data or Appearance tab, for example the following picture shows a data mapping for a Text Box Element:

Picture showing sample mapping for a Text Box Element.

The top value is empty showing there is no input mapping for this Element. If the Element had an input mapping the mapping would be displayed here, marked with a Picture showing Input-Mapped icon. icon. For some Elements, such as a Text Box, you can provide an initial value to be displayed in the Element when the form loads, in which case that value would be displayed here with no icon.

The lower value, marked with the Picture showing Output-Mapped icon. icon, shows any output mapping defined.

  • Although generally you can configure separate input and output mappings for the Elements, you will need to be careful about only specifying output mappings where records can be edited and updated.

    For edited records, when the screen values are updated in the current record, Digitise Forms compares the values in all Elements output mapped to the relevant Dataset against the values in the current record for that Dataset to see if the data has changed and hence the record needs to be updated. If a user doesn't enter a value or make a selection in an Element which has an output mapping but no equivalent input mapping, that Element won't contain a value. Consequently, when Digitise Forms compares the Element's value against its equivalent column in the current record, the two values will be different if the current record does contain a value in that column. Digitise Forms will consider this a change of value and update the column with the empty value, effectively clearing the original value. If this is not what you want to happen, you will need to input map the Element, so that it contains the current record column value and therefore there will be no change if the user doesn't specifically change the value on the form.

    When you publish a form, Form Studio will display a warning message for any Elements where this situation could potentially arise.

    This issue only affects updating records, it isn't relevant when creating new records.

 

 

 


See also:

Sanitize Data